package cn.laixueit.api;

import cn.laixueit.pojo.item.Sku;
import cn.laixueit.pojo.item.Spu;
import cn.laixueit.pojo.item.SpuDetail;
import cn.laixueit.pojo.result.PageResult;
import cn.laixueit.pojo.vo.SpuVo;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.Collection;

public interface GoodsApi {


    /**
     *
     * @param id spuid
     * @return
     */
    @GetMapping("/sku/list")
    public ResponseEntity<Collection<Sku>> list(@RequestParam("id") Long id);

    /**
     * 根据spuid查询对应详情
     */
    @GetMapping("/spu/detail/{id}")
    public ResponseEntity<SpuDetail> detail(@PathVariable("id")Long id);

    @GetMapping("/spu/page")
    public ResponseEntity<PageResult<SpuVo>> page(@RequestParam(value = "key",required = false) String key,
                                                  @RequestParam(value = "saleable",required = false) Boolean saleable,
                                                  @RequestParam(value = "page",defaultValue = "1") Integer page,
                                                  @RequestParam(value = "rows",defaultValue = "5") Integer rows);

    /**
     * 根据spuid查询spu
     * @return
     */
    @GetMapping("/spu/{id}")
    public ResponseEntity<Spu> findSpuById(@PathVariable("id")Long id);


    /**
     * 查询sku
     * @param skuid
     * @return
     */
    @GetMapping("/sku")
    public ResponseEntity<Sku> getSkuById(@RequestParam("skuid")Long skuid);
}
